<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="renderer" content="webkit">
    <title>{$system.sitename}后台管理中心 - 广告管理 - 广告列表</title>
    <link href="__PUBLIC__/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
    
</head>

<body>

            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>广告管理</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="__MODULE__/Index/index">主页</a>
                        </li>
                        <li>
                            <a href="__MODULE__/System/index">系统设置</a>
                        </li>
                        <li>
                            <a href="__MODULE__/Ad/index">广告管理</a>
                        </li>
                        <li>
                            <strong>广告列表</strong>
                        </li>
                    </ol>
                </div>
            </div>
                <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>广告列表</h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link" title="收起页面">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" title="删除广告">
                                        <i class="fa  fa-trash-o text-danger"></i>
                                    </a>
                                    <ul class="dropdown-menu dropdown-user">
                                        <li><a id="quanxuan" >全选</a></li>
                                        <li><a id="fanxuan" >反选</a></li>
                                        <li><a id="quxiao" >取消</a></li>
                                        <li><a id="shanchu" >删除</a></li>
                                    </ul>
                                    <a title="添加广告" href="__MODULE__/Ad/addad" class="close-link">
                                    <i class="fa fa-plus text-navy"></i>
                                    </a>
                                    <a href="#" class="close-link" title="隐藏页面">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <form action="__MODULE__/Ad/index"  method="post">
                            <div class="ibox-content">
                                <div class="row">
                                    <div class="col-sm-5 m-b-xs">
                                        <select class="input-sm form-control input-s-sm inline" name="ad_classid" id="class">
                                            <option value="1">首页轮播广告1920*600</option>
                                            <option value="2">首页中上部广告600*300</option>
                                        </select>
                                    </div>
                                    <div class="col-sm-4 m-b-xs">
                                    <!--中间部分为空-->
                                    </div>
                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input type="text" placeholder="请输入关键词" class="input-sm form-control" name="ad_name"> <span class="input-group-btn">
                                        <button type="submit" id="submit" class="btn btn-sm btn-primary" name="submit">查 询</button> </span>
                                        </div>
                                    </div>
                                </div>
                                </form>
                                <!--表格-->
                                <div class="table-responsive">
                                    <table class="table table-striped">
                                        <thead>
                                            <tr>

                                                <th>ID</th>
                                                <th>广告名称</th>
                                                <th>广告位置</th>
                                                <th>广告图片</th>
                                                <th>链接网址</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <volist name="ad" id="vo">
                                            <tr>
                                                <td>
                                                    <input type="checkbox"  class="i-checks"  value="{$vo.ad_id}" name="ad_id[]">
                                                    <span>{$vo.ad_id}</span>
                                                </td>
                                                <td>{$vo.ad_name}</td>
                                                <td><span class="pie"><if condition="$vo.ad_classid eq 1">首页轮播广告1920*600<else />首页中上部广告600*300</if></span>
                                                </td>
                                                <td>
                                                <a class="fancybox" href="__PUBLIC__/{$vo.ad_img}" title="{$vo.ad_name}">
                                                <img alt="{$vo.ad_name}" src="__PUBLIC__/{$vo.ad_img}" style=" height:50px; width:auto;">
                                                </a>
                                                </td>
                                                <td>{$vo.ad_url}</td>
                                                <td>
                                                <a href="__MODULE__/Ad/editAd/adid/{$vo.ad_id}"><i class="fa fa-edit text-navy"></i></a>
                                                <a href="__MODULE__/Ad/delAd/adid/{$vo.ad_id}"><i class="fa  fa-trash-o text-danger"></i></a>
                                                </td>
                                            </tr>  
                                            </volist>
                                        </tbody>
                                    </table>
                                </div>

                            </div>
                        </div>
                    </div>

    <!-- Fancy box查看大图效果 CLASS为fancybox -->
    <script src="__PUBLIC__/js/plugins/fancybox/jquery.fancybox.js"></script>
    <script>
        $(document).ready(function () {
            $('.fancybox').fancybox({
                openEffect: 'none',
                closeEffect: 'none'
            });
        });
    </script>
    <!--批量删除广告-->
    <script type="text/javascript" src="__PUBLIC__/js/checkbox.js"></script>
	<script>
    $(function(){
        $("#quanxuan").bind('click',function(){
            $(".i-checks").quanxuan();
            });
            $("#quxiao").bind('click',function(){
                $(".i-checks").quxiao();
                });
            $("#fanxuan").bind('click',function(){
                $(".i-checks").fanxuan();
                });	
            $("#shanchu").bind('click',function(){
                var xiaoyu= $(".i-checks").is(":checked");
                if(xiaoyu==false){
                    alert("您还没有选择要删除的选项！");
                }else{
                if(confirm("您确定要删除所有选中数据吗？")){
                    var array = new Array();
                    $(".i-checks:checked").each(function(){
                        array.push($(this).val());
                    });
                    $.ajax({ 
                        type:"POST",
                        url:"__MODULE__/Ad/delAd",
                        data:"id="+array,
                        success: function(msg){
							if(msg==false){
								alert("删除失败！");
								}else{
									$(".i-checks:checked").parents("tr").remove();
									}
                             
                            }
                        });
                    }else{
                    $(".i-checks").quxiao();
                    }
                }
                });
        });
    </script>
</body>
</html>
